package com.xiaoma.lock.myreentrancelock;

/**
 * Created by Fant.J.
 * 2018/3/6 20:24
 */
public class MyLockTest{
    
    public int value = 0;
    
    MyLock myLock = new MyLock();
    
    public void a(){
        myLock.lock();
        System.out.println("a");
        b();
        myLock.unlock();
    }
    
    public void b(){
        myLock.lock();
        System.out.println("b");
        myLock.unlock();
    }
    
    public static void main(String [] args){
        
        MyLockTest task = new MyLockTest();
        new Thread(){
            
            @Override
            public void run(){
                task.a();
            }
        }.start();
        
        new Thread(){
            
            @Override
            public void run(){
                task.b();
            }
        }.start();
    }
}
